package j180.javaoo.homework;

/**
 * 一  ：如下一个字符串:”91 27 46 3850，请写代码实现最终输出结果是："27 46 91 3850" (字符串型小到大输出)
 */
public class HomeWork01 {
    public static void main(String[] args){
        System.out.println(f("91 27 46 3850"));
    }

    public static String f(String s){
        String[] ss = s.split(" ");
        for (int i = 0; i < ss.length; i++) {
            for (int j = i+1; j < ss.length; ++j) {
                if(Integer.parseInt(ss[i]) > Integer.parseInt(ss[j])){
                    String t = ss[i];
                    ss[i] = ss[j];
                    ss[j] = t;
                }
            }
        }

        String st = "";
        for (int i = 0; i < ss.length; i++) {
            st = st + ss[i] + " ";
        }
        return st;
    }
}
